package com.wy.authority.service.impl;


import com.wy.authority.entity.Configure;
import com.wy.authority.mapper.ConfigureMapper;
import com.wy.authority.service.ConfigureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author 忘忧
 * @Date Created in 2021/1/4 17:20
 * @Description:
 */
@Service
public class ConfigureServiceImpl implements ConfigureService {
    @Autowired
    private ConfigureMapper configureMapper;



    @Override
    @Transactional
    public Configure find_bynum(Integer pagenum, Integer pagesize) {
      Configure configure = new Configure();
        //默认从O开始
        if(pagenum !=null && pagesize !=null){
           pagenum =(pagenum-1)*pagesize;
        }
        //获取当前用户信息
       List<Configure> configures  =configureMapper.find_bynum(pagenum,pagesize);
       configure.setData(configures);
       //获取当前用户总量
        Long total =configureMapper.getMsgtotal();
        configure.setTotal(total);
        System.out.println(configure);
        return configure;
    }

    @Override
    public Long getMsgtotal() {
        return configureMapper.getMsgtotal();
    }

    @Override
    public List<Configure> find_all_table() {
        return configureMapper.find_all_table();
    }

    @Override
    public List<Configure> find_column(String table_name) {
        return configureMapper.find_column(table_name);
    }

    @Override
    public List<Configure> find_byid(int id) {
        return configureMapper.find_byid(id);
    }


    @Override
    public List<Configure> findall() {
        return configureMapper.findall();
    }

    @Override
    public Configure find_basic(String msg_name) {

        return configureMapper.find_basic(msg_name);
    }

    @Override
    public List<Configure> find_send() {
        return configureMapper.find_send();
    }

    @Override
    public List<Configure> finduser(String table_name,String column_name) {
        return configureMapper.finduser(table_name,column_name);
    }

    @Override
    public List<Configure> fuzzy_query(String msg_name, String send_way, String status, String istiming) {
        return configureMapper.fuzzy_query(msg_name,send_way,status,istiming);
    }


    @Override
    public int insert(Configure configure) {
        return configureMapper.insert(configure);
    }

    @Override
    public int insert2(Configure configure) {
        return configureMapper.insert2(configure);
    }

    @Override
    public int insert3(Configure configure) {
        return configureMapper.insert3(configure);
    }

    @Override
    public int insert4(Configure configure) {
        return configureMapper.insert4(configure);
    }

    @Override
    public int update(Configure configure) {
        return configureMapper.update(configure);
    }

    @Override
    public int update2(Configure configure) {
        return configureMapper.update2(configure);
    }

    @Override
    public int update3(Configure configure) {
        return configureMapper.update3(configure);
    }

    @Override
    public int delete(int id) {
        return configureMapper.delete(id);
    }
}
